home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / warlord.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  11KB  |  311 lines

  1. /***************************************************************************
  2. Warlords Driver by Lee Taylor and John Clegg
  3.  
  4.  
  5.               Warlords Memory map and Dip Switches
  6.               ------------------------------------
  7.  
  8.  Address  R/W  D7 D6 D5 D4 D3 D2 D1 D0   Function
  9. --------------------------------------------------------------------------------------
  10. 0000-03FF       D  D  D  D  D  D  D  D   RAM
  11. --------------------------------------------------------------------------------------
  12. 0400-07BF       D  D  D  D  D  D  D  D   Screen RAM (8x8 TILES, 32x32 SCREEN)
  13. 07C0-07CF       D  D  D  D  D  D  D  D   Motion Object Picture
  14. 07D0-07DF       D  D  D  D  D  D  D  D   Motion Object Vert.
  15. 07E0-07EF       D  D  D  D  D  D  D  D   Motion Object Horiz.
  16. --------------------------------------------------------------------------------------
  17. 0800       R    D  D  D  D  D  D  D  D   Option Switch 1 (0 = On) (DSW 1)
  18. 0801       R    D  D  D  D  D  D  D  D   Option Switch 2 (0 = On) (DSW 2)
  19. --------------------------------------------------------------------------------------
  20. 0C00       R    D                        Cocktail Cabinet  (0 = Cocktail)
  21.            R       D                     VBLANK  (1 = VBlank)
  22.            R          D                  SELF TEST
  23.            R             D               DIAG STEP (Unused)
  24. 0C01       R    D  D  D                  R,C,L Coin Switches (0 = On)
  25.            R             D               Slam (0 = On)
  26.            R                D            Player 4 Start Switch (0 = On)
  27.            R                   D         Player 3 Start Switch (0 = On)
  28.            R                      D      Player 2 Start Switch (0 = On)
  29.            R                         D   Player 1 Start Switch (0 = On)
  30. --------------------------------------------------------------------------------------
  31. 1000-100F  W   D  D  D  D  D  D  D  D    Pokey
  32. --------------------------------------------------------------------------------------
  33. 1800       W                             IRQ Acknowledge
  34. --------------------------------------------------------------------------------------
  35. 1C00-1C02  W    D  D  D  D  D  D  D  D   Coin Counters
  36. --------------------------------------------------------------------------------------
  37. 1C03-1C06  W    D  D  D  D  D  D  D  D   LEDs
  38. --------------------------------------------------------------------------------------
  39. 4000       W                             Watchdog
  40. --------------------------------------------------------------------------------------
  41. 5000-7FFF  R                             Program ROM
  42. --------------------------------------------------------------------------------------
  43.  
  44. Game Option Settings - J2 (DSW1)
  45. =========================
  46.  
  47. 8   7   6   5   4   3   2   1       Option
  48. ------------------------------------------
  49.                         On  On      English
  50.                         On  Off     French
  51.                         Off On      Spanish
  52.                         Off Off     German
  53.                     On              Music at end of each game
  54.                     Off             Music at end of game for new highscore
  55.         On  On                      1 or 2 player game costs 1 credit
  56.         On  Off                     1 player game=1 credit, 2 player=2 credits
  57.         Off Off                     1 or 2 player game costs 2 credits
  58.         Off On                      Not used
  59. -------------------------------------------
  60.  
  61.  
  62. Game Price Settings - M2 (DSW2)
  63. ========================
  64.  
  65. 8   7   6   5   4   3   2   1       Option
  66. ------------------------------------------
  67.                         On  On      Free play
  68.                         On  Off     1 coin for 2 credits
  69.                         Off On      1 coin for 1 credit
  70.                         Off Off     2 coins for 1 credit
  71.                 On  On              Right coin mech x 1
  72.                 On  Off             Right coin mech x 4
  73.                 Off On              Right coin mech x 5
  74.                 Off Off             Right coin mech x 6
  75.             On                      Left coin mech x 1
  76.             Off                     Left coin mech x 2
  77. On  On  On                          No bonus coins
  78. On  On  Off                         For every 2 coins, add 1 coin
  79. On  Off On                          For every 4 coins, add 1 coin
  80. On  Off Off                         For every 4 coins, add 2 coins
  81. Off On  On                          For every 5 coins, add 1 coin
  82. ------------------------------------------
  83.  
  84.  
  85. ***************************************************************************/
  86.  
  87. #include "driver.h"
  88. #include "vidhrdw/generic.h"
  89.  
  90. void warlord_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  91. void warlord_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  92.  
  93. static WRITE_HANDLER( warlord_led_w )
  94. {
  95.     osd_led_w(offset,~data >> 7);
  96. }
  97.  
  98.  
  99.  
  100. static struct MemoryReadAddress readmem[] =
  101. {
  102.     { 0x0000, 0x07ff, MRA_RAM },
  103.     { 0x0800, 0x0800, input_port_2_r },    /* DSW1 */
  104.     { 0x0801, 0x0801, input_port_3_r },    /* DSW2 */
  105.     { 0x0c00, 0x0c00, input_port_0_r },    /* IN0 */
  106.     { 0x0c01, 0x0c01, input_port_1_r },    /* IN1 */
  107.     { 0x1000, 0x100f, pokey1_r },        /* Read the 4 paddle values & the random # gen */
  108.     { 0x5000, 0x7fff, MRA_ROM },
  109.     { 0xf800, 0xffff, MRA_ROM },        /* for the reset / interrupt vectors */
  110.     { -1 }    /* end of table */
  111. };
  112.  
  113. static struct MemoryWriteAddress writemem[] =
  114. {
  115.     { 0x0000, 0x03ff, MWA_RAM },
  116.     { 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
  117.     { 0x07c0, 0x07ff, MWA_RAM, &spriteram },
  118.     { 0x1000, 0x100f, pokey1_w },
  119.     { 0x1800, 0x1800, MWA_NOP },        /* IRQ Acknowledge */
  120.     { 0x1c00, 0x1c02, coin_counter_w },
  121.     { 0x1c03, 0x1c06, warlord_led_w },    /* 4 start lights */
  122.     { 0x4000, 0x4000, watchdog_reset_w },
  123.     { -1 }    /* end of table */
  124. };
  125.  
  126.  
  127. INPUT_PORTS_START( warlord )
  128.     PORT_START    /* IN0 */
  129.     PORT_BIT ( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
  130.     PORT_DIPNAME(0x10, 0x00, "Diag Step" )  /* Not referenced */
  131.     PORT_DIPSETTING (   0x00, DEF_STR( Off ) )
  132.     PORT_DIPSETTING (   0x10, DEF_STR( On ) )
  133.     PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
  134.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )
  135.     PORT_DIPNAME(0x80, 0x00, DEF_STR( Cabinet ) )
  136.     PORT_DIPSETTING (   0x80, DEF_STR( Upright ) )
  137.     PORT_DIPSETTING (   0x00, DEF_STR( Cocktail ) )
  138.  
  139.     PORT_START    /* IN1 */
  140.     PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  141.     PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  142.     PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  143.     PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
  144.     PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_TILT )
  145.     PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  146.     PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  147.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
  148.  
  149.     PORT_START    /* IN2 */
  150.     PORT_DIPNAME(0x03, 0x00, "Language" )
  151.     PORT_DIPSETTING (   0x00, "English" )
  152.     PORT_DIPSETTING (   0x01, "French" )
  153.     PORT_DIPSETTING (   0x02, "Spanish" )
  154.     PORT_DIPSETTING (   0x03, "German" )
  155.     PORT_DIPNAME(0x04, 0x00, "Music" )
  156.     PORT_DIPSETTING (   0x00, "End of game" )
  157.     PORT_DIPSETTING (   0x04, "High score only" )
  158.     PORT_BIT ( 0xc8, IP_ACTIVE_HIGH, IPT_UNUSED )
  159.     PORT_DIPNAME(0x30, 0x00, "Credits" )
  160.     PORT_DIPSETTING (   0x00, "1p/2p = 1 credit" )
  161.     PORT_DIPSETTING (   0x10, "1p = 1, 2p = 2" )
  162.     PORT_DIPSETTING (   0x20, "1p/2p = 2 credits" )
  163.  
  164.     PORT_START    /* IN3 */
  165.     PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )
  166.     PORT_DIPSETTING (   0x03, DEF_STR( 2C_1C ) )
  167.     PORT_DIPSETTING (   0x02, DEF_STR( 1C_1C ) )
  168.     PORT_DIPSETTING (   0x01, DEF_STR( 1C_2C ) )
  169.     PORT_DIPSETTING (   0x00, DEF_STR( Free_Play ) )
  170.     PORT_DIPNAME(0x0c, 0x00, "Right Coin" )
  171.     PORT_DIPSETTING (   0x00, "*1" )
  172.     PORT_DIPSETTING (   0x04, "*4" )
  173.     PORT_DIPSETTING (   0x08, "*5" )
  174.     PORT_DIPSETTING (   0x0c, "*6" )
  175.     PORT_DIPNAME(0x10, 0x00, "Left Coin" )
  176.     PORT_DIPSETTING (   0x00, "*1" )
  177.     PORT_DIPSETTING (   0x10, "*2" )
  178.     PORT_DIPNAME(0xe0, 0x00, "Bonus Coins" )
  179.     PORT_DIPSETTING (   0x00, "None" )
  180.     PORT_DIPSETTING (   0x20, "3 credits/2 coins" )
  181.     PORT_DIPSETTING (   0x40, "5 credits/4 coins" )
  182.     PORT_DIPSETTING (   0x60, "6 credits/4 coins" )
  183.     PORT_DIPSETTING (   0x80, "6 credits/5 coins" )
  184.  
  185.     /* IN4-7 fake to control player paddles */
  186.     PORT_START
  187.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER1, 50, 10, 0x1d, 0xcb )
  188.  
  189.     PORT_START
  190.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER2, 50, 10, 0x1d, 0xcb )
  191.  
  192.     PORT_START
  193.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER3, 50, 10, 0x1d, 0xcb )
  194.  
  195.     PORT_START
  196.     PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER4, 50, 10, 0x1d, 0xcb )
  197. INPUT_PORTS_END
  198.  
  199.  
  200. static struct GfxLayout charlayout =
  201. {
  202.     8,8,    /* 8*8 characters */
  203.     64,        /* 64  characters */
  204.     2,        /* 2 bits per pixel */
  205.     { 128*8*8, 0 },    /* bitplane separation */
  206.     { 7, 6, 5, 4, 3, 2, 1, 0 },
  207.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  208.     8*8    /* every char takes 8 consecutive bytes */
  209. };
  210.  
  211.  
  212.  
  213. static struct GfxDecodeInfo gfxdecodeinfo[] =
  214. {
  215.     { REGION_GFX1, 0x0000, &charlayout,   0,   8 },
  216.     { REGION_GFX1, 0x0200, &charlayout,   8*4, 8 },
  217.     { -1 } /* end of array */
  218. };
  219.  
  220.  
  221.  
  222. static struct POKEYinterface pokey_interface =
  223. {
  224.     1,    /* 1 chip */
  225.     12096000/8,    /* 1.512 MHz */
  226.     { 100 },
  227.     /* The 8 pot handlers */
  228.     { input_port_4_r },
  229.     { input_port_5_r },
  230.     { input_port_6_r },
  231.     { input_port_7_r },
  232.     { 0 },
  233.     { 0 },
  234.     { 0 },
  235.     { 0 },
  236.     /* The allpot handler */
  237.     { 0 },
  238. };
  239.  
  240.  
  241.  
  242. static struct MachineDriver machine_driver_warlord =
  243. {
  244.     /* basic machine hardware */
  245.     {
  246.         {
  247.             CPU_M6502,
  248.             12096000/16, /* 756 kHz */
  249.             readmem,writemem,0,0,
  250.             interrupt,4
  251.         }
  252.     },
  253.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  254.     1,
  255.     0,
  256.  
  257.     /* video hardware */
  258.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 30*8-1 },
  259.     gfxdecodeinfo,
  260.     128, 8*4+8*4,
  261.     warlord_vh_convert_color_prom,
  262.  
  263.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
  264.     0,
  265.     generic_vh_start,
  266.     generic_vh_stop,
  267.     warlord_vh_screenrefresh,
  268.  
  269.     /* sound hardware */
  270.     0,0,0,0,
  271.     {
  272.         {
  273.             SOUND_POKEY,
  274.             &pokey_interface
  275.         }
  276.     }
  277. };
  278.  
  279.  
  280.  
  281. /***************************************************************************
  282.  
  283.   Game driver(s)
  284.  
  285. ***************************************************************************/
  286.  
  287. ROM_START( warlord )
  288.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  289.     ROM_LOAD( "037154.1m",    0x5000, 0x0800, 0x18006c87 )
  290.     ROM_LOAD( "037153.1k",    0x5800, 0x0800, 0x67758f4c )
  291.     ROM_LOAD( "037158.1j",    0x6000, 0x0800, 0x1f043a86 )
  292.     ROM_LOAD( "037157.1h",    0x6800, 0x0800, 0x1a639100 )
  293.     ROM_LOAD( "037156.1e",    0x7000, 0x0800, 0x534f34b4 )
  294.     ROM_LOAD( "037155.1d",    0x7800, 0x0800, 0x23b94210 )
  295.     ROM_RELOAD(            0xf800, 0x0800 )    /* for the reset and interrupt vectors */
  296.  
  297.     ROM_REGION( 0x0800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  298.     ROM_LOAD( "037159.6e",    0x0000, 0x0800, 0xff979a08 )
  299.  
  300.     ROM_REGION( 0x0100, REGION_PROMS )
  301.     /* Only the first 0x80 bytes are used by the hardware. A7 is grounded. */
  302.     /* Bytes 0x00-0x3f are used fore the color cocktail version. */
  303.     /* Bytes 0x40-0x7f are for the upright version of the cabinet with a */
  304.     /* mirror and painted background. */
  305.     ROM_LOAD( "warlord.clr",  0x0000, 0x0100, 0xa2c5c277 )
  306. ROM_END
  307.  
  308.  
  309.  
  310. GAME( 1980, warlord, 0, warlord, warlord, 0, ROT0, "Atari", "Warlords" )
  311.